let channel = channels[i];
let [targetHandle, targetHandleType] = channel.get_handle();
- if (Shell.is_channel_invalidated(channel))
+ if (channel.get_invalidated())
continue;
/* Only observe contact text channels */
continue;
}
- if (Shell.is_channel_invalidated(channel))
+ if (channel.get_invalidated())
continue;
// 'notify' will be true when coming from an actual HandleChannels
// We can only approve the rooms if we have been invited to it
let selfContact = channel.group_get_self_contact();
if (selfContact == null) {
- Shell.decline_dispatch_op(context, 'Not invited to the room');
+ context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+ message: 'Not invited to the room' }));
return;
}
let [invited, inviter, reason, msg] = channel.group_get_local_pending_contact_info(selfContact);
if (!invited) {
- Shell.decline_dispatch_op(context, 'Not invited to the room');
+ context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+ message: 'Not invited to the room' }));
return;
}
let channel = channels[0];
let chanType = channel.get_channel_type();
- if (Shell.is_channel_invalidated(channel)) {
- Shell.decline_dispatch_op(context, 'Channel is invalidated');
+ if (channel.get_invalidated()) {
+ context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+ message: 'Channel is invalidated' }));
return;
}
else if (chanType == Tp.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
this._approveFileTransfer(account, conn, channel, dispatchOp, context);
else
- Shell.decline_dispatch_op(context, 'Unsupported channel type');
+ context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+ message: 'Unsupported channel type' }));
},
_approveTextChannel: function(account, conn, channel, dispatchOp, context) {
G_CALLBACK (on_contact_list_changed),
self);
}
-
-/* Telepathy utility functions */
-
-/* gjs doesn't allow us to craft a GError so we need a C wrapper */
-void
-shell_decline_dispatch_op (TpAddDispatchOperationContext *context,
- const gchar *message)
-{
- GError *error = g_error_new_literal (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
- message);
-
- tp_add_dispatch_operation_context_fail (context, error);
- g_error_free (error);
-}
-
-/* gjs doesn't cope with tp_proxy_get_invalidated() returning a GError */
-gboolean shell_is_channel_invalidated (TpChannel *channel)
-{
- return tp_proxy_get_invalidated (channel) != NULL;
-}